<template>
  <div>
    <el-table
      :data="secklist"
      style="width: 100%"
      row-key="id"
      border
      lazy
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
    >
      <el-table-column prop="title" label="活动名称"></el-table-column>
      <el-table-column prop="status" label="状态">
        <template slot-scope="scope">
          <el-button type="primary" v-if="scope.row.status==1">启用</el-button>
          <el-button type="info" v-else>禁用</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="操作">
        <template slot-scope="scope">
          <el-button type="primary" @click="change(scope.row.id)">修改</el-button>
          <el-button type="danger" @click="del(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { mapGetters, mapActions } from "vuex";
import {
  reqseckadd,
  reqseckdit,
  reqseckdelete
} from "../../../request/api.js";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapGetters({
      info: "seckill/info",
      secklist: "seckill/secklist",
      
    })
  },
  methods: {
    ...mapActions({
      reqsecklist: "seckill/secklist",
      reqseckinfo: "seckill/seckinfo",
      
    }),
    change(id) {
      this.info.isadd = false;
      this.info.isshow = true;
      this.reqseckinfo({ id: id });
    },
    del(id) {
      reqseckdelete({ id: id });
      this.reqsecklist();
    }
  },
  mounted() {
    this.reqsecklist();
  }
};
</script>

<style scoped>
img{width: 100px;height: 100px;}
</style>